#include "AABB.h"
#include <cassert>

namespace Engine
{
	Vec3 AABB::GetCorner(unsigned int n) const
	{
		assert((n > -1) && (n < 8));

		//0------1
		//|\     |\
		//| 4----+-5
		//2-+----3 |
		// \|     \|
		//  6------7
		Vec3 result;
		
		if((n % 2) == 0) result.x = min.x;
		else result.x = max.x;

		if((n == 0) || (n == 1) || (n == 4) || (n == 5)) result.y = max.y;
		else result.y = min.y;

		if((n == 0) || (n == 1) || (n == 2) || (n == 3)) result.z = min.z;
		else result.z = max.z;

		return result;
	}
}